<?php

require_once './include/common.inc.php';
require_once './include/show_page.php';
require_once 'left.php';
require_once 'right.php';

$page_title = 'Acuity World WebShop';
$menu_id = 0;
$menu_str = PrintMenu();
$page= new show_page();
$pagesize=10;

$promoter_menu_id = 3;
$promoter_menu_str = PrintPromoterMenu();

if (isPromoterLogin()) {
    $sql = "SELECT * FROM  `promoter_info` WHERE  `id` = '$promoter_uid'";
    $promoter_info_ary = $db->get_one($sql); 
} else {
    header("LOCATION:promoter_login.php");
    exit;
}
$sql_num="select pc.id  from `promoter_commission` pc, `cus_order` co,`cus_members` cus where  pc.order_id = co.id and co.pay_flag=0 and co.user_id=cus.id and pc.promoter_id=$promoter_uid";
$numall=$mysql->getnum($sql_num);
$page->set($pagesize,$numall);


$sql="select pc.*,cus.firstname,cus.lastname,cus.id  from `promoter_commission` pc, `cus_order` co,`cus_members` cus where  pc.order_id = co.id and co.pay_flag=0 and co.user_id=cus.id and pc.promoter_id=$promoter_uid limit ".$page->limit();;//支付不成功的订单不算佣金

$comminssion_ary=$mysql->fetch($sql);
$show_page= $page->output(true);
if($page->tpage<=1) $strshow=" style=\"display:none;\"";
else $strshow="";
$asa = 0;   // Accumulated Sales Amount
$ac = 0;    // Accumulated Commission
$cp = 0;    // Commission Paid
$co = 0;    // Commission Outstanding

$cms=getCms($promoter_uid);
$asa=$cms["cost"];
$ac=$cms["cms"];
$co=$cms["cms_osd"];
$cp=$cms["cms_paid"];

require_once PrintEot('header');
require_once PrintEot('left');
require_once PrintEot('promoter_sales');
require_once PrintEot('right');
require_once PrintEot('footer');

?>